#include "MsgNode.h"

RecvNode::RecvNode(short max_len, short msg_id):MsgNode(max_len),_msg_id(msg_id)
{
}

SendNode::SendNode(const char* data, short max_len, short msg_id):MsgNode(max_len+HEAD_TOTAL_LEN),_msg_id(msg_id)
{
	short net_msg_id = boost::asio::detail::socket_ops::host_to_network_short(msg_id);
	short net_msg_len = boost::asio::detail::socket_ops::host_to_network_short(max_len);
	memcpy(_data, &net_msg_id, HEAD_ID_LEN);
	memcpy(_data + HEAD_ID_LEN, &net_msg_len, HEAD_MSG_LEN);
	memcpy(_data + HEAD_TOTAL_LEN, data, max_len);
}
